<template>
<div>
  <h1>登录页面</h1>
  <p>登录账号：<input type="text" v-model="form.username"></p>
  <p>登录密码<input type="text" v-model="form.password"></p>
  <button @click="ss">确认登录</button>
</div>
</template>

<script>
export default {
  name: "denglu",
  data(){
    return{
      form:{}
    }
  },
  methods:{
    ss(){
      this.$axios.post('users/UserAPI/',this.form)
        .then(res=>{
          if(res.data.code==200){
            alert('登录成功')
            localStorage.setItem('userid',res.data.userid)
            this.$router.push({path:'/lxx'})
          }
          else {
            alert(res.data.code)
          }
        })
    }
  }
}
</script>

<style scoped>

</style>
